<template>
<div>
  请求到的数据: {{ message1 }}
  <el-button @click="getMessage2" type="primary">请求</el-button>
  请求到的数据: {{ message2 }}
</div>
</template>

<script>
const axios = require('axios');
export default {
  name: "Axios01",
  data() {
    return {
      message1: null,
      message2: null
    }
  },
  methods: {
    getMessage1() {
      axios.get("http://localhost:8888/api/01").then((response) => {
        this.message1 = response.data
      })
    },
    getMessage2() {
      axios.get("http://localhost:8888/api/02").then((response) => {
        this.message2 = response.data
      })
    }
  },
  created() {
    this.getMessage1()
  }
}
</script>

<style scoped>

</style>